package Array;

public class arrayMaximum {
    public static void main(String[] args) {
        int[] arr = {2, 3, 6, 1, 4};
        //min存储最小值，max存储最大值
        int min = arr[0];
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i];
            }
            if (arr[i] > max) {
                max = arr[i];
            }

        }
        System.out.println("最小值：" + min);
        System.out.println("最大值：" + max);
    }
}
